/*  Copyright 2010 Daniel Brasil Magnani
 *  Created on: Dec 20, 2010
 *      Author: daniel
 */

#ifndef CSP_CONSTRUCTIVE_H_
#define CSP_CONSTRUCTIVE_H_

#include <vector>
#include "instance.h"

class Constructive {
 public:
  // Get method for the solution
  std::vector<Car> get_solution();

  // Initialize the solution
  Constructive(const std::vector<Car> &yesterday_cars,
               const std::vector<Car> &today_cars,
               const std::vector<Constraint> &constraint_list);

  // Execute the constructive heuristic
  int Execute(const std::vector<Car> &yesterday_cars,
              const std::vector<Car> &today_cars,
              const std::vector<Constraint> &constraint_list);

 private:
  // Create/Update the vector used by the constructive heuristic
  void CounterVector(const std::vector<Constraint> &constraint_list,
                     std::vector<Cost> *cost_counter);

  // Create/Update the utilization_rate_ vector
  void UtilizationRate(const std::vector<Constraint> &constraint_list,
                       std::vector<Car> *S);

  // Retrieve the cost of the insertion of the car in the last position
  // of the sequence
  Cost CostFrontInsert(const std::vector<Constraint> &constraint_list,
                       const std::vector<Cost> &cost_counter,
                       const Car temp_car);

  Cost cost_;
  std::vector<float> utilization_rate_;
  std::vector<Car> solution_;
  int solution_size_;
  int constraint_size_;
  int yesterday_size_;
};

#endif  // CSP_CONSTRUCTIVE_H_
